package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.DrugallergyInfoPack;

import java.util.List;

@Dao
public interface DrugallergyInfoPackDao {
    @Query("delete from drugallergyInfoPack")
    int deleteAll();

    @Delete
    int delete(DrugallergyInfoPack drugallergyInfoPack);

    @Query("SELECT * FROM drugallergyInfoPack")
    List<DrugallergyInfoPack> getAll();

    @Query("SELECT * FROM drugallergyInfoPack WHERE createOrUpdate =:isCreateUpdate")
    List<DrugallergyInfoPack> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM drugallergyInfoPack WHERE identity_code IN (:identity_code)")
    List<DrugallergyInfoPack> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<DrugallergyInfoPack> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(DrugallergyInfoPack user);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    int update(DrugallergyInfoPack user);
}

